import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    redirect: '/recommend',
    children: [
      {
        path: '/recommend',
        component: () => import('@/views/Recommend/index.vue'),
      },
      {
        path: '/FM',
        component: () => import('@/views/FM/index.vue'),
      },
      {
        path: '/newCD',
        component: () => import('@/views/NewCD/index.vue'),
      },
      {
        path: '/rank',
        component: () => import('@/views/Rank/index.vue'),
      },

      {
        path: '/singer',
        name: 'Singer',
        component: () => import('@/views/Singer/index.vue'),
      },

      {
        path: '/singer/detail',
        name: 'SingerDetail',
        component: () => import('@/components/SingerDetail/index.vue'),
        redirect: '/singer/detail/hotsongs',
        children: [
          {
            path: 'hotsongs',
            name: 'HotSongs',
            component: () =>
              import('@/components/SingerDetail/Hotsongs/index.vue'),
          },
          {
            path: 'albums',
            name: 'Albums',
            component: () =>
              import('@/components/SingerDetail/Albums/index.vue'),
          },
          {
            path: 'mv',
            name: 'Mv',
            component: () => import('@/components/SingerDetail/Mv/index.vue'),
          },
          {
            path: 'desc',
            name: 'Desc',
            component: () => import('@/components/SingerDetail/Desc/index.vue'),
          },
        ],
      },
      {
        path: '/songList',
        component: () => import('@/views/SongList/index.vue'),
      },
      {
        path: '/detail/:path',
        component: () => import('@/views/Detail/index.vue'),
      },
      {
        path: '/songDetail',
        component: () => import('@/views/Detail/songDetail/index.vue'),
      },
    ],
  },
  {
    path: '/search',
    name: 'Search',

    component: () => import('@/views/Search/index.vue'),
    // children: [
    //   {
    //     path: '/search/single',
    //     name: 'Single',

    //     component: () => import('@/views/Search/components/Single/index.vue'),
    //   },
    //   {
    //     path: '/search/album',
    //     name: 'Album',
    //     component: () => import('@/views/Search/components/Album/index.vue'),
    //   },
    //   {
    //     path: '/search/lyric',
    //     name: 'Lyric',
    //     component: () => import('@/views/Search/components/Lyric/index.vue'),
    //   },
    //   {
    //     path: '/search/singer',
    //     name: 'SearchSinger',
    //     component: () => import('@/views/Search/components/Singer/index.vue'),
    //   },
    //   {
    //     path: '/search/user',
    //     name: 'User',
    //     component: () => import('@/views/Search/components/User/index.vue'),
    //   },
    //   {
    //     path: '/search/video',
    //     name: 'Video',
    //     component: () => import('@/views/Search/components/Video/index.vue'),
    //   },
    //   {
    //     path: '/search/songSheet',
    //     name: 'songSheet',
    //     component: () =>
    //       import('@/views/Search/components/songSheet/index.vue'),
    //   },
    //   {
    //     path: '/search/voiceAnchor',
    //     name: 'voiceAnchor',
    //     component: () =>
    //       import('@/views/Search/components/voiceAnchor/index.vue'),
    //   },
    // ],
  },
]

export const router = createRouter({
  history: createWebHistory(),
  routes,
  scrollBehavior() {
    return { top: 0, left: 0 }
  },
})
